package receiver;

import static com.qb.devserv.MainActivity.mActivity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInstaller;

import utils.MyUtil;

public class UnInstallResultReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        MyUtil.showLog("UnInstallResultReceiver action", action);
        //安装广播
        if (intent != null) {
            final int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS,PackageInstaller.STATUS_FAILURE);
            MyUtil.showLog("UnInstallResultReceiver status",status);
            if (status == PackageInstaller.STATUS_SUCCESS) {
                MyUtil.showLog("UnInstallResultReceiver success", "success");
//                mActivity.upLoadDevDetail();
            } else {
                String msg = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE);
                MyUtil.showLog("UnInstallResultReceiver fail", msg);
            }
        } else {
            MyUtil.showLog("UnInstallResultReceiver intent == null", "");
        }
    }
}